import request from "@/utils/request";
import { AxiosPromise } from "axios";
import {DyBillPageVO, DyBillQuery} from "@/api/fundsDailyReport/types";

/**
 * 抖音原始账单查询接口
 *
 * @param queryParams
 */
export function getBillColumnPage(
	queryParams: DyBillQuery
): AxiosPromise<PageResult<DyBillPageVO[]>> {
	return request({
		url: '/api/v1/dyBill/page',
		method: 'get',
		params: queryParams
	});
}

/**
 * 下载标准账单配置导入模板
 *
 * @returns
 */
export function downloadTemplateApi() {
	return request({
		url: '/api/v1/billColumn/template',
		method: 'get',
		responseType: 'arraybuffer'
	});
}

/**
 * 导入标准账单配置
 *
 * @param file
 */
export function importBillColumn(file: File) {
	const formData = new FormData();
	formData.append('file', file);
	return request({
		url: '/api/v1/billColumn/_import',
		method: 'post',
		data: formData,
		headers: {
			'Content-Type': 'multipart/form-data'
		}
	});
}
